﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using Bussiness;

namespace EWebsite.Admin.Partnerships {
    public partial class CheckInventory : System.Web.UI.Page {
        protected void Page_Load(object sender, EventArgs e) {
            if (!IsPostBack) {
                //get partnerships info
                try {
                    int partnerID = int.Parse(Request["partner"]);
                    PartnershipBuss buss = new PartnershipBuss();
                    grvList.DataSource = buss.getPartnerships(partnerID);
                    grvList.DataBind();
                }
                catch (Exception ex) {

                }
            }
        }

        protected void Button1_Click(object sender, EventArgs e) {
            //update inventory
            foreach (DataRow row in grvList.Rows) {
                //
                if (DateTime.Now > (DateTime)row["EndDate"]) {
                    //login, get session id
                    object[] arr = new object[] { "ProviderID", "ProviderPassword" };
                    object obj = WSProxy.CallWebService("url", "Servicename", "CheckInventory", arr);
                    if(!obj.ToString().Equals("")){ //login successful
                        //check inventory

                    }
                }
            }
        }
    }
}